/**
 * $Id$
 * @author mcanovas
 * @date   Sep 8, 2011 11:33:03 AM
 *
 * Copyright (C) 2011 Scytl Secure Electronic Voting SA
 *
 * All rights reserved.
 *
 */
package org.sk.gsync.app.synch;

import java.util.List;

import org.sk.gsync.app.mybatis.Folder;
import org.sk.gsync.app.mybatis.FolderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

public class SynchDispatcher {

    @Autowired
    @Qualifier("downloader")
    private Downloader downloader;

    @Autowired
    @Qualifier("uploader")
    private Uploader uploader;

    @Autowired
    private FolderService folderService;

    public void start() {
        List<Folder> folders = folderService.getFolders();
        for (Folder folder : folders) {
            downloader.start();
            downloader.setFolder(folder.getPath());
            uploader.start();
            uploader.setFolder(folder.getPath());
        }
    }
}
